

def remove_other_chars():
    string = '''
    现在很多外 科 医 生 在显微外 科
    手术 中 使用 机 器人助手
    。
    '''

    s = string.replace(' ', '').replace('\n', '')
    print(s)

def unicode2chinese():
    path = r'C:\Users\vanlance\Desktop\CPS-OCR-Engine-master\ocr\labels.txt'
    with open(path,'r') as f:
        with open(r'C:\Users\vanlance\Desktop\CPS-OCR-Engine-master\ocr\label.txt','w') as w:
        
            s = f.readlines()
            print(len(s))
            for i in s:
                w.write(chr(eval(i)) + '\n')

def unicode2utf8():
    path = r'C:\Users\vanlance\Desktop\CPS-OCR-Engine-master\ocr\labels.txt'
    with codecs.open(path,'r',encoding='UTF-8') as rf:
        with codecs.open('labels.txt','w','GBK') as wf:
            lines = rf.readlines()
            for l in lines :
                wf.write(l,'\n')